package com.zyk.scaffold.seata.biz.feign.order.request;

import com.zyk.scaffold.seata.biz.business.buy.pojo.request.BuyRequest;
import lombok.Data;

@Data
public class OrderRequest {
    private String userId;
    private String commodityCode;
    private Integer money;
    private Integer count;

    public static OrderRequest of(String userId, String commodityCode, Integer money, Integer count){
        OrderRequest orderRequest = new OrderRequest();
        orderRequest.setUserId(userId);
        orderRequest.setCommodityCode(commodityCode);
        orderRequest.setMoney(money);
        orderRequest.setCount(count);
        return orderRequest;
    }

    public static OrderRequest of(BuyRequest buyRequest, Integer money) {
        return of(buyRequest.getUserId(), buyRequest.getCommodityCode(), money, buyRequest.getCount());
    }
}
